<?php
class index extends CI_Controller{
	
	function __construct()
	{
		parent::__construct();
		//加载url辅助类
		$this->load->helper('url');
		//连接数据库
		$this->load->database(); 
	}
	
	//初始化首页
	function index($offset='')
	{
		
		//加载分页类
		$this->load->library('pagination');
		$config['base_url'] = "/xmates/index/index";
		$config['total_rows'] = $this->db->count_all('mb_webblogs'); 
    	$config['per_page'] = '1';  
    	$config['first_link'] = '首页';
    	$config['last_link'] = '尾页';
    	$config['next_link'] = '下一页';
    	$config['prev_link'] = '上一页';
    	$config['full_tag_open']  = '<div class="pagination">';//分页样式开始
    	$config['full_tag_close'] = '</div>'; //分页样式结束
    	$config['cur_tag_open'] = ' <a class="current">';//当前页样式开始
    	$config['cur_tag_close'] = ' </a>';//当前页样式结束
		
    	$this->pagination->initialize($config); //配置分页

		//加载模型获得结果
    	$this->load->model('Index_model',``,TRUE);
		$data['query'] = $this->Index_model->get_content_list($config['per_page'],$offset);
		
		// load the HTML Table Class  
		$this->load->view('view_index',$data);
	}
	
}
